/**
 * File: FilePoolInfo.java
 * Created by: mhaimel
 * Created on: 10 Aug 2009
 * CVS:  $Id: FilePoolInfo.java,v 1.2 2009/10/09 15:16:53 mhaimel Exp $
 */
package uk.ac.ebi.curtain.util.file.impl;

import java.io.File;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import uk.ac.ebi.curtain.util.file.impl.FileAccessPool.ChannelType;

/**
 * @author mhaimel
 *
 */
public class FilePoolInfo {
	private final File file;
	private final ChannelType type;
	private final Boolean read;
	
	private FilePoolInfo() {
		this(null,null, null);
	}

	public FilePoolInfo(File file, ChannelType type, Boolean read) {
		super();
		this.file = file;
		this.type = type;
		this.read = read;
	}

	public File getFile() {
		return file;
	}

//	public void setFile(File file) {
//		this.file = file;
//	}

	public ChannelType getType() {
		return type;
	}

//	public void setType(ChannelType type) {
//		this.type = type;
//	}

	
	public Boolean getRead() {
		return read;
	}

//	public void setRead(Boolean read) {
//		this.read = read;
//	}

	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((file == null) ? 0 : file.hashCode());
		result = prime * result + ((read == null) ? 0 : read.hashCode());
		result = prime * result + ((type == null) ? 0 : type.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		FilePoolInfo other = (FilePoolInfo) obj;
		if (file == null) {
			if (other.file != null)
				return false;
		} else if (!file.equals(other.file))
			return false;
		if (read == null) {
			if (other.read != null)
				return false;
		} else if (!read.equals(other.read))
			return false;
		if (type == null) {
			if (other.type != null)
				return false;
		} else if (!type.equals(other.type))
			return false;
		return true;
	}
}
